# -*- coding = utf-8 -*-
# @Time : 2022/2/17 16:34
# @File : phone.py
# @Software : PyCharm

import time


class Book:
    book = {
        "1859633644841": "赵亮",
        "1357845614561": "拜登",
        "1357238273987": "杰伦"
    }


class OldNokia:
    phoneNumber = ""
    address = ""
    voice = ""

    def call(self, number):
        if self.phoneNumber == "":
            print("您的号码为空")
        else:
            print(self.phoneNumber, "正在给", number, Book.book[number],
                  "打电话\n本机号码归属地:", self.address, "\n铃声:", self.voice)
            for i in range(3):
                print(".", end="")
                time.sleep(1)
            print("\n对方已成功接通！")


class NewNokia(OldNokia):
    picture = ""
    mic = False
    balance = 0
    jifen = 0

    def call(self, number):
        self.mic = True
        string = ""
        if self.mic == True:
            string = "开启"
        else:
            string = "关闭"
        super().call(number)
        if self.phoneNumber == "":
            print("本次通话已结束!")
        else:
            print("对方头像为:", self.picture)
            print("录音功能:", string)

    def billing(self, a):
        b = self.balance
        d = self.jifen
        t = self.phoneNumber
        if self.phoneNumber == "":
            pass
        else:
            for i in range(3):
                print(".", end="")
                time.sleep(1)
            print("\n本次通话已结束！")
            if a == 0:
                print("手机号码为", t, "的用户，\n您的通话时长为", a, "分钟，不计费")
            elif self.balance < 1:
                print("温馨提示，你的话费余额不足，拨打失败")
            else:
                print("电话成功拨通!")
                if 0 < a <= 10:
                    a1 = b - (1 * a)
                    a2 = 1 * a
                    d1 = d + (15 * a)
                    print("手机号码为", t, "的用户，\n您的通话时长为", a, "分钟，\n扣除话费", a2, "元，\n话费剩余", a1, "元，\n积分剩余", d1)
                elif 11 < a <= 20:
                    a1 = b - (0.8 * a)
                    a2 = 0.8 * a
                    d1 = d + (39 * a)
                    print("手机号码为", t, "的用户，\n您的通话时长为", a, "分钟，\n扣除话费", a2, "元，\n话费剩余", a1, "元，\n积分剩余", d1)
                elif a > 20:
                    a1 = b - (0.65 * a)
                    a2 = 0.65 * a
                    d1 = d + (48 * a)
                    print("手机号码为", t, "的用户，\n您的通话时长为", a, "分钟，\n扣除话费", a2, "元，\n话费剩余", a1, "元，\n积分剩余", d1)


phone = NewNokia()
phone.phoneNumber = "18810205448"
phone.address = "北京移动 5G"
phone.voice = "海阔天空"
phone.picture = "冰墩墩"
phone.balance = 200
phone.jifen = 100

phone.call("1357845614561"), phone.billing(30)
